#include "cocos2d.h"
#include "ADUConstant.h"
#include "ADUConfig.h"
#include "ADUGameManager.h"
#include "ADUParticleEmitter.h"
USING_NS_CC;

class Flow : public Node, public BlendProtocol {
public:
		Flow(Vec2& _position);
		~Flow();
		void 		 initPhysics();
		void 		 update(float dt);
		void 		 createFlow();
		void		 createFaucet();
		void		 createWall();
		virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t transformFlags) override;
	    void 		 onDraw(const Mat4 &transform, uint32_t transformFlags);
    	const BlendFunc& getBlendFunc() const override;
	    void 		 setBlendFunc(const cocos2d::BlendFunc &var) override;
		bool 		 initShader(b2ParticleSystem* particleSystem, float ratio);
		void 		 setup();	

		RadialEmitter				mEmitter;
private:
		
		CustomCommand 				mCustomCommand;
    	cocos2d::Mat4 				mRatioTransform;
	    float 						mRatio;
    	GLfloat * 					mSizes;
	    BlendFunc 					mBlendFunc;
	    Texture2D *					mTexture;
	    RenderTexture *				mRenderTexture;
		b2ParticleSystem *			mParticleSystem;
		b2World *					mWorld;

		ParticleLifetimeRandomizer 	mLifetimeRandomizer;
		Vec2						mPosition;
};